import { createBrowserRouter } from "react-router-dom";
import App from "../App";

// 定义路由
const routes=createBrowserRouter([
    {
        path:'/',
        element:<App/>,
        children:[
             {
                index:true,
                lazy:async()=>{
                    const {default:Index}= await import('../pages/index/Index')
                    return{
                        element:<Index/>
                    }
                }
            },
            {
                path:'index',
                lazy:async()=>{
                    const {default:Index}= await import('../pages/index/Index')
                    return{
                        element:<Index/>
                    }
                }
            },
            {
                path:'message',
                lazy:async()=>{
                    const {default:Message}= await import('../pages/message/Index')
                    return{
                        element:<Message/>
                    }
                }
            },
            {
                path:'order',
                lazy:async()=>{
                    const {default:Order}= await import('../pages/order/Index')
                    return{
                        element:<Order/>
                    }
                }
            },
            {
                path:'user',
                lazy:async()=>{
                    const {default:User}= await import('../pages/user/Index')
                    return{
                        element:<User/>
                    }
                }
            }
        ]
    }
])
export default routes